package com.xfcy.blog.dto;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xfcy.blog.common.constant.DateConstant;
import com.xfcy.blog.valid.AddGroup;
import com.xfcy.blog.valid.UpdateGroup;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author 晓风残月Lx
 * @date 2023/5/26 15:25
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageDTO {

    @Null(message = "id必须为空", groups = AddGroup.class)
    @NotNull(message = "id必须不为空", groups = {AddGroup.class, UpdateGroup.class})
    private Long id;

    @NotBlank(message = "页面名称不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String pageName;

    @NotBlank(message = "页面标签不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String pageLabel;

    @NotBlank(message = "页面封面不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String pageCover;

    //创建时间
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = DateConstant.FORMAT_STRING, timezone = DateConstant.GMT_TIMEZONE)
    private LocalDateTime createTime;
    //修改时间
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = DateConstant.FORMAT_STRING, timezone = DateConstant.GMT_TIMEZONE)
    private LocalDateTime updateTime;

}
